//
//  RBSecondKillDetailVC.m
//  zhongzhenglu
//
//  Created by 马军凯 on 2023/3/24.
//

#import "RBSecondKillDetailVC.h"
#import "RBNavigationBar.h"
#import <UINavigationController+FDFullscreenPopGesture.h>
#import "RBTimer.h"
#import "RBSecondKillDetailResponse.h" //model
#import "RBHomeBannerView.h" //轮播图
#import "RBShopDetailVC.h" //店铺详情
#import "RBShopIntroVC.h" //店铺
#import "RBGoodsDetailMultipleChoosePopVC.h"
#import "RBGoodsDetailParamPopVC.h"
#import "RBGoodsAddToothPopVC.h"
#import "RBGoodsDetailWebView.h"
#import "RBSecondKillConfirmOrderVC.h" //确认订单

@interface RBSecondKillDetailVC ()
<UIScrollViewDelegate>
//导航栏
@property (nonatomic, strong) RBNavigationBar *navigationBar;
@property (nonatomic, strong) UIView *backBtn;
@property (nonatomic, strong) UILabel *titleL;

//scrollView
@property (nonatomic, strong) UIScrollView *scrollView;
//轮播图
@property (nonatomic, strong) RBHomeBannerView *bannerView;
//商品
@property (nonatomic, strong) IBOutlet UIView *infoView;
@property (nonatomic, strong) IBOutlet UILabel *priceL;
@property (nonatomic, strong) IBOutlet UILabel *orgPriceL;
@property (nonatomic, strong) IBOutlet UILabel *timeL;
@property (nonatomic, strong) IBOutlet UILabel *nameL;
@property (nonatomic, strong) IBOutlet UILabel *desL;
@property (nonatomic, strong) IBOutlet UIView *shareView;
@property (weak, nonatomic) IBOutlet UILabel *sellNumL;
//webView
@property (nonatomic, strong) UIView *goodsDetailView;
@property (nonatomic, strong) RBGoodsDetailWebView *detailWebView;
//底部view
@property (nonatomic, strong) UIView *bottomView;
//属性
@property (nonatomic, retain) NSArray *specArray;
@property (nonatomic, retain) NSMutableArray *toothBtnsArrayM;

@property (nonatomic, strong) RBSecondKillDetailResponse *response;

@property (nonatomic, strong) RBTimer *timer;
/**
    尝试通过刷新数据来校正页面
    后台数据不正确的情况下会校正失败,为了防止无休止刷新,只做一次校正
 */
@property (nonatomic, assign) BOOL triedToAjustByReloadData;


@end

@implementation RBSecondKillDetailVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setup];
    __weak typeof(self) weak_self = self;
    [self.timer startTimerWithInterval:1 block:^(float countF, NSInteger countI) {
        [weak_self reloadTimeDisplay];
    }];
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [self getData];
}

- (void)setup {
    self.fd_prefersNavigationBarHidden = YES;
    self.view.backgroundColor = [RBThemeConfig bgGrayColor];
    self.scrollView.hidden = NO;
    self.navigationBar.hidden = NO;
    self.bottomView.hidden = YES;
    [self.infoView zoomSubViewsWithSelf];
    [self.shareView rbAddTapGesWithTarget:self action:@selector(shareBtnTapped)];
}
- (void)fillData {
    //model
    RBSecondKillDetailModel *allModel = self.response.data;
    //
    CGFloat whiteW = Zoom(350);
    CGFloat paddingTop = Zoom(15);
    //显示
    self.bottomView.hidden = NO;
    //scrollView
    [self.scrollView view_clear];
    [self.scrollView rbSetContentWidth:kRBMainScreenWidth];
    //轮播图
    NSArray *picArray;
    if (allModel.picarr && allModel.picarr.count > 0) {
        picArray = allModel.picarr;
    } else {
        picArray = @[allModel.picurl];
    }
    self.bannerView.dataSource = picArray;
    [self.scrollView addView:self.bannerView withHeight:self.bannerView.height width:self.bannerView.width top:0 bottom:0 left:0 right:0 centerX:0];
    //商品信息
    [self reloadPrice];
    self.orgPriceL.attributedText = [RanTool attributeStringMaker:^(NSMutableArray *maker) {
        [maker addAttributeStringWithFont:[UIFont systemFontOfSize:Zoom(13)] color:[UIColor colorWithHexString:@"#FFC9C9"] string:[NSString stringWithFormat:@"原价：¥%@", allModel.shop_price] lineSpacing:0 througnLineHeight:1 throughLineColor:[UIColor colorWithHexString:@"#FFC9C9"]];
    }];
    [self reloadTimeDisplay];
    self.nameL.text = allModel.good_name;
    self.desL.text = allModel.cate_name;
    self.sellNumL.text = [NSString stringWithFormat:@"销量%@", allModel.sale_num];
    [self.scrollView addView:self.infoView withHeight:CGFLOAT_MIN width:whiteW top:paddingTop bottom:0 left:CGFLOAT_MIN right:CGFLOAT_MIN centerX:YES];
    /*
    //属性
    self.specArray = ({
        NSMutableArray *arrayM = NSMutableArray.array;
        for (RBSecondKillDetailSepcModel *model in allModel.goods_spec) {
            if (model.status == 1) {
                [arrayM addObject:model];
                model.level = 2;
                if (model.spec.count) {
                    RBSecondKillDetailSepcItemModel *l2Model = model.spec.firstObject;
                    if (l2Model.spec_son.count) {
                        model.level = 3;
                    }
                }
                if(model.model_type == 1) {
                    for (RBSecondKillDetailSepcItemModel *itemModel in model.spec) {
                        if (itemModel.is_default) {
                            model.selIndex = [model.spec indexOfObject:itemModel];
                            break;
                        }
                    }
                }
            }
        }
        arrayM;
    });
    //属性赋值
    for (RBSecondKillDetailSepcModel *model in self.specArray) {
        [self.scrollView addView:({
            UIView *view = UIView.new;
            switch (model.model_type) {
                case 1 : {
                    view = [self paramsSingleDisplayType1ViewWithData:model];
                }   break;
                case 2 : {
                    view = [self paramsMultiplePopType2ViewWithData:model];
                }   break;
                case 3 : {
                    view = [self paramsSelectorPopType3ViewWithData:model];
                }   break;
                case 4 : {
                    view = [self paramsSinglePopType4ViewWithData:model];
                }   break;
                case 5 : {
                    view = [self paramsChooseToothDisplayType5ViewWithData:model];
                }   break;
                case 6 : {
                    view = [self paramsAddToothPopType6ViewWithData:model];
                }   break;
            }
            view;
        }) withHeight:CGFLOAT_MIN width:whiteW top:paddingTop bottom:0 left:CGFLOAT_MIN right:CGFLOAT_MIN centerX:YES];
    }
     */
    //评价
    if (allModel.evaluate.count > 0) {
        [self.scrollView addView:[self evaluateViewWith:allModel] withHeight:CGFLOAT_MIN width:whiteW top:Zoom(15) bottom:0 left:CGFLOAT_MIN right:CGFLOAT_MIN centerX:YES];
    }
    //店铺信息
    [self.scrollView addView:[self shopViewWith:allModel.shop_info] withHeight:CGFLOAT_MIN width:whiteW top:paddingTop bottom:0 left:CGFLOAT_MIN right:CGFLOAT_MIN centerX:YES];
    //详情
    if (allModel.content && allModel.content.length > 0) {
        [self.scrollView addView:[self detailView] withHeight:CGFLOAT_MIN width:whiteW top:paddingTop bottom:0 left:CGFLOAT_MIN right:CGFLOAT_MIN centerX:YES];
        LCWeakSelf;
        self.detailWebView.heightChangeBlock = ^(CGFloat currentHeight) {
            [weakSelf.detailWebView mas_updateConstraints:^(MASConstraintMaker *make) {
                make.height.mas_equalTo(currentHeight);
            }];
        };
        //
        self.detailWebView.content = allModel.content;
    }
    //占位
    [self.scrollView addView:UIView.new withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:paddingTop bottom:0 left:CGFLOAT_MIN right:CGFLOAT_MIN centerX:0];
}
//刷新价格
- (void)reloadPrice {
    //model
    RBSecondKillDetailModel *model = self.response.data;
    //属性
    CGFloat total_price = [model.sell_price floatValue];
//    for (RBSecondKillDetailSepcModel *model in self.specArray) {
//        if (model.model_type == 6) {
//            for (RBSecondKillDetailSepcItemModel *item in model.spec) {
//                if (item.selected) {
//                    total_price = total_price + item.count * [item.spec_price floatValue];
//                }
//            }
//        }
//    }
    model.total_price = [NSString stringWithFormat:@"%.2f", total_price];
    self.priceL.attributedText = [RanTool attributeStringMaker:^(NSMutableArray *maker) {
        [maker addAttributeStringWithFont:[UIFont boldSystemFontOfSize:Zoom(17)] color:UIColor.whiteColor string:@"¥"];
        [maker addAttributeStringWithFont:[UIFont boldSystemFontOfSize:Zoom(30)] color:UIColor.whiteColor string:[RanTool priceFromPrice:model.total_price][0]];
        [maker addAttributeStringWithFont:[UIFont boldSystemFontOfSize:Zoom(24)] color:UIColor.whiteColor string:@"."];
        [maker addAttributeStringWithFont:[UIFont boldSystemFontOfSize:Zoom(24)] color:UIColor.whiteColor string:[RanTool priceFromPrice:model.total_price][1]];
    }];
}


#pragma mark - Network
//详情请求
- (void)getData {
    LCWeakSelf;
    [self viewLoadDataWithParam:^(NSMutableDictionary *dicM) {
        dicM[@"seckill_id"] = self.goods_id;
        dicM[@"user_id"] = [RBAccountManager getUserId];
    } path:_Seckill_detail post:YES log:YES responseClass:RBSecondKillDetailResponse.class desView:self.view showHud:YES showPlaceHolder:YES sucBlock:^(id data) {
        weakSelf.response = data;
        [weakSelf fillData];
    } failBlock:^(RBSecondKillDetailResponse *data) {
        [weakSelf.view showTip:data.message completion:nil];
    } reloadBlock:nil];
}



#pragma mark - 活动时间刷新
- (void)reloadTimeDisplay {
    if (!self.response) {
        return;
    }
    //针对未开始和进行中的倒计时校验一次
    if (!self.triedToAjustByReloadData) {
        self.triedToAjustByReloadData = YES;
        [self getData];
    }
    
    CGFloat padding = Zoom(5);
    UIColor *color = UIColor.whiteColor;
    UIFont *bigFont = [UIFont systemFontOfSize:Zoom(14) weight:UIFontWeightMedium];
    UIFont *smallFont = [RanTool numFontWithSize:Zoom(12)];
    self.timeL.attributedText = [RanTool attributeStringMaker:^(NSMutableArray *maker) {
        [maker addAttributeStringWithFont:bigFont color:color string:@"距离活动结束" lineSpacing:padding];
        [maker addAttributeStringWithFont:smallFont color:color string:@"\n" lineSpacing:padding];
        [maker addAttributeStringWithFont:smallFont color:color string:[self countDownTimeFromTimeStamp:[NSString timeChangeTimeString:self.response.data.end_time].doubleValue - [NSDate.date timeIntervalSince1970]] lineSpacing:padding];
    }];
    self.timeL.numberOfLines = 0;
    self.timeL.textAlignment = NSTextAlignmentRight;
}
- (NSString *)countDownTimeFromTimeStamp:(double)timeStamp {
    NSArray *timeArray = [RanTool dayHourMinuteSecondFromInterval:timeStamp];
    NSMutableString *stringM = NSMutableString.string;
    NSString *dayStr = timeArray[0];
    if (dayStr.intValue) {
        [stringM appendFormat:@"%@天",timeArray[0]];
    }
    [stringM appendFormat:@"%@：%@：%@",timeArray[1],timeArray[2],timeArray[3]];
    return stringM;
}


#pragma mark - Event
//返回
- (void)backBtnTapped {
    [self.navigationController popViewControllerAnimated:YES];
}
//分享
- (void)shareBtnTapped {
//    RBGoodsSharePopVC *vc = RBGoodsSharePopVC.new;
//    [self presentVc:vc];
}
//选择牙齿
- (void)toothBtnTapped: (UIButton *)btn {
    btn.selected = !btn.selected;
    RBSecondKillDetailSepcItemModel *model = btn.rbExData;
    model.selected = btn.selected;
}
//查看全部评价
- (void)checkTotalEvaluateAction {
    
}
//联系客服
- (void)clickContactService {
    
}
//店铺的商品
- (void)tapShopGood:(UITapGestureRecognizer *)ges {
//    RBGoodsDetailShopGoodsModel *model = ges.view.rbExData;
//    RBGoodsDetailVC *vc = RBGoodsDetailVC.new;
//    vc.id = model.id;
//    [self.navigationController pushViewController:vc animated:YES];
}
//进店逛逛
- (void)tapShop:(UITapGestureRecognizer *)ges {
    RBShopDetailVC *vc = RBShopDetailVC.new;
    vc.id = self.response.data.shop_info.id;
    [self.navigationController pushViewController:vc animated:YES];
}
//店铺信息
- (void)tapShopInfo:(UITapGestureRecognizer *)ges {
    RBShopIntroVC *vc = RBShopIntroVC.new;
    vc.id = self.response.data.shop_info.id;
    [self.navigationController pushViewController:vc animated:YES];
}
//立即购买
- (void)buyBtnTapped {
    if ([[RBAccountManager getUserId] length] > 0) {
        RBSecondKillConfirmOrderVC *vc = RBSecondKillConfirmOrderVC.new;
        vc.seckill_id = self.goods_id;
        [self.navigationController pushViewController:vc animated:YES];
    } else {
        [RBAppDelegateHelper showLoginPageWithCompletion:^{
            
        }];
    }
}

#pragma mark - paramsEvent
/** 1单选模板[显示] */
- (void)paramsType1ItemTapped:(UITapGestureRecognizer *)ges {
    UIView *view = ges.view.superview;
    RBSecondKillDetailSepcModel *model = view.rbExData;
    model.selIndex = ges.view.tag - 1000;
    for (UIView *itemView in view.subviews) {
        if (itemView.tag >= 1000) {
            UIImageView *imgView = (UIImageView *)[itemView viewWithTag:333];
            imgView.image = [UIImage imageNamed:model.selIndex == itemView.tag - 1000? @"addressListDefault": @"goodsDetailParamsUnSel"];
        }
    }
}
/** 2多选模板[弹出] */
- (void)paramsType2ViewTapped:(UITapGestureRecognizer *)ges {
    __weak typeof(self) weak_self = self;
    RBSecondKillDetailSepcModel *model = ges.view.rbExData;
    RBGoodsDetailMultipleChoosePopVC *vc = RBGoodsDetailMultipleChoosePopVC.new;
    vc.title = model.name;
    vc.options = model.spec;
    vc.dismissBlock = ^{
        if (ges.view.tag == 2002) {
            [weak_self reloadParamsType2:ges.view];
        }
    };
    [self presentVc:vc];
}
/** 2多选模板[弹出] 赋值 */
- (void)reloadParamsType2:(UIView *)view {
    RBSecondKillDetailSepcModel *model = view.rbExData;
    UILabel *desL = (UILabel *)[view viewWithTag:333];
    desL.text = ({
        NSMutableArray *arrayM = NSMutableArray.array;
        for (RBSecondKillDetailSepcItemModel *item in model.spec) {
            if (item.selected) {
                [arrayM addObject:item.spec_name];
            }
        }
        [arrayM componentsJoinedByString:@" "];
    });
}
/** 3选择器模板[弹出] */
- (void)paramsType3ViewTapped:(UITapGestureRecognizer *)ges {
    __weak typeof(self) weak_self = self;
    RBSecondKillDetailSepcModel *model = ges.view.rbExData;
    RBGoodsDetailParamPopVC *vc = RBGoodsDetailParamPopVC.new;
    vc.title = model.name;
    vc.options = model.spec;
    vc.level = model.level;
    vc.dismissBlock = ^{
        if (ges.view.tag == 2003) {
            [weak_self reloadParamsType3:ges.view];
        }
    };
    [self presentVc:vc];
}
/** 3选择器模板[弹出] 赋值 */
- (void)reloadParamsType3: (UIView *)view {
    RBSecondKillDetailSepcModel *model = view.rbExData;
    UILabel *desL = (UILabel *)[view viewWithTag:333];
    desL.text = ({
        NSMutableArray *arrayM = NSMutableArray.array;
        if (model.level == 2) {
            for (RBSecondKillDetailSepcItemModel *item in model.spec) {
                if (item.selected) {
                    [arrayM addObject:item.spec_name];
                    break;
                }
            }
        } else if(model.level == 3) {
            for (RBSecondKillDetailSepcItemModel *gModel in model.spec) {
                for (RBSecondKillDetailSepcItemModel *item in gModel.spec_son) {
                    if (item.selected) {
                        [arrayM addObject:gModel.spec_name];
                        [arrayM addObject:item.spec_name];
                        break;
                    }
                }
            }
        }
        [arrayM componentsJoinedByString:@" "];
    });
}
/** 4单选模板[弹出][多项] **/
- (void)paramsType4ViewTapped:(UITapGestureRecognizer *)ges {
    __weak typeof(self) weak_self = self;
    RBSecondKillDetailSepcModel *model = ges.view.rbExData;
    RBGoodsDetailMultipleChoosePopVC *vc = RBGoodsDetailMultipleChoosePopVC.new;
    vc.title = model.name;
    vc.options = model.spec;
    vc.singleSelect = YES;
    vc.dismissBlock = ^{
        if (ges.view.tag == 2004) {
            [weak_self reloadParamsType4:ges.view];
        }
    };
    [self presentVc:vc];
}
/** 4单选模板[弹出][多项] 赋值 **/
- (void)reloadParamsType4: (UIView *)view {
    RBSecondKillDetailSepcModel *model = view.rbExData;
    UILabel *desL = (UILabel *)[view viewWithTag:333];
    desL.text = ({
        NSMutableArray *arrayM = NSMutableArray.array;
        for (RBSecondKillDetailSepcItemModel *item in model.spec) {
            if (item.selected) {
                [arrayM addObject:item.spec_name];
            }
        }
        [arrayM componentsJoinedByString:@" "];
    });
}
/** 6牙排模板[弹出] */
- (void)paramsType6ViewTapped: (UITapGestureRecognizer *)ges {
    __weak typeof(self) weak_self = self;
    RBSecondKillDetailSepcModel *model = ges.view.rbExData;
    RBGoodsAddToothPopVC *vc = RBGoodsAddToothPopVC.new;
    vc.title = model.name;
    vc.options = model.spec;
    vc.dismissBlock = ^{
        if (ges.view.tag == 2006) {
            [weak_self reloadParamsType6:ges.view];
        }
    };
    [self presentVc:vc];
}
/** 6牙排模板[弹出] 赋值 */
- (void)reloadParamsType6: (UIView *)view {
    RBSecondKillDetailSepcModel *model = view.rbExData;
    UILabel *desL = (UILabel *)[view viewWithTag:333];
    desL.text = ({
        NSMutableArray *arrayM = NSMutableArray.array;
        for (RBSecondKillDetailSepcItemModel *item in model.spec) {
            if (item.selected) {
                [arrayM addObject:[NSString stringWithFormat:@"%@(x%zd)",item.spec_name, item.count]];
            }
        }
        [arrayM componentsJoinedByString:@" "];
    });
    [self reloadPrice];
}

#pragma mark - UIScrollViewDelegate

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    CGFloat duration = kRBMainScreenWidth;
    CGFloat factor = MIN(1, scrollView.contentOffset.y/duration);
    self.navigationBar.backgroundAlpha = factor;
    self.titleL.hidden = factor > 0.5? NO: YES;
}

#pragma mark - Getter
//导航栏
- (RBNavigationBar *)navigationBar {
    if (!_navigationBar) {
        self.navigationBar = ({
            RBNavigationBar *view = RBNavigationBar.new;
            view.needGradientView = NO;
            [view.naviBar addBackBtn];
            view.bgColor = UIColor.whiteColor;
            
            self.titleL = [RanTool labelWithFontSize:17 weight:0 color:[RBThemeConfig textBlackColor] align:1 text:@"秒杀详情"];
            [view.naviBar view_addView:self.titleL withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:CGFLOAT_MIN right:CGFLOAT_MIN centerX:YES];
            self.titleL.hidden = YES;
            
            UIView *backBtn = ({
                UIView *view = UIView.new;
                view.backgroundColor = [UIColor colorWithWhite:1 alpha:0.5];
                [view rbSetCornerRadius:17];
                
                UIImageView *imgView = [RanTool imgViewWithMode:1 radius:0 imgName:@"backBlack"];
                [view addSubview:imgView];
                [imgView mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.center.mas_equalTo(0);
                    make.width.height.mas_equalTo(Zoom(18));
                }];
                
                view;
            });
            [view rbAddTapGesWithTarget:self action:@selector(backBtnTapped)];
            [view setResponseArea:UIEdgeInsetsMake(Zoom(12), Zoom(12), Zoom(12), Zoom(12))];
            [view.naviBar addSubview:backBtn];
            [backBtn mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.mas_equalTo(10);
                make.width.height.mas_equalTo(34);
                make.centerY.mas_equalTo(0);
            }];
            
            [self.view addSubview:view];
            [view mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.right.top.mas_equalTo(0);
                make.height.mas_equalTo(kRBStatusBarHeight + kRBNavigationBarHeight);
            }];
            view;
        });
    }
    return _navigationBar;
}
//scrollView
- (UIScrollView *)scrollView {
    if (!_scrollView) {
        self.scrollView = ({
            UIScrollView *view = UIScrollView.new;
            view.backgroundColor = [RBThemeConfig bgGrayColor];
            view.delegate = self;
            [self.view addSubview:view];
            [view mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.right.mas_equalTo(0);
                make.bottom.mas_equalTo(self.bottomView.mas_top);
                make.top.mas_equalTo(kRBStatusBarHeight);
            }];
            view;
        });
    }
    return _scrollView;
}
//轮播图
- (RBHomeBannerView *)bannerView {
    if (!_bannerView) {
        self.bannerView = ({
            RBHomeBannerView *view = RBHomeBannerView.new;
            [view rbSetCornerRadius:0];
            view.width = kRBMainScreenWidth;
            view.height = kRBMainScreenWidth;
            view;
        });
    }
    return _bannerView;
}
//属性
/** 1单选模板[显示] */
- (UIView *)paramsSingleDisplayType1ViewWithData:(RBSecondKillDetailSepcModel *)data {
    UIView *view = UIView.new;
    [view view_addView:({
        UIView *view = UIView.new;
        view.backgroundColor = UIColor.whiteColor;
        [view rbSetCornerRadius:Zoom(8)];
        
        [view view_addView:({
            UIView *view = UIView.new;
            [view h_view_addView:({
                UILabel *view = [RanTool labelWithFontSize:Zoom(15) weight:2 color:[RBThemeConfig textBlackColor] align:0 text:data.name];
                [view addPriority:1];
                view;
            }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerY:0];
            [view h_view_addView:[RanTool labelWithFontSize:Zoom(13) weight:0 color:[RBThemeConfig textBlackColor] align:0 text:@"(必选)"] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerY:0];
            view;
        }) withHeight:Zoom(44) width:CGFLOAT_MIN top:Zoom(4) bottom:Zoom(10) left:Zoom(16) right:Zoom(16) centerX:0];
        
        [view view_addView:({
            UIView *view = UIView.new;
            view.rbExData = data;
            for (NSInteger i = 0; i < data.spec.count; i++) {
                RBGoodsDetailSpecItemModel *model = data.spec[i];
                [view h_view_addView:({
                    UIView *view = UIView.new;
                    [view rbAddTapGesWithTarget:self action:@selector(paramsType1ItemTapped:)];
                    view.tag = 1000 + i;
                    [view h_view_addView:({
                        UIImageView *view = [RanTool imgViewWithMode:0 radius:0 imgName:data.selIndex == i? @"addressListDefault": @"goodsDetailParamsUnSel"];
                        view.tag = 333;
                        view;
                    }) withHeight:Zoom(12) width:Zoom(12) top:CGFLOAT_MIN bottom:CGFLOAT_MIN left:0 right:0 centerY:YES];
                    [view h_view_addView:[RanTool labelWithFontSize:Zoom(13) weight:0 color:[RBThemeConfig textBlackColor] align:0 text:model.spec_name] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:Zoom(7) right:0 centerY:0];
                    view;
                }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:i?Zoom(16):0 right:CGFLOAT_MIN centerY:0];
            }
            view;
        }) withHeight:Zoom(44) width:CGFLOAT_MIN top:0 bottom:Zoom(12) left:Zoom(16) right:Zoom(16) centerX:0];
        
        view;
    }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerX:NO];
    return view;
}
/** 2多选模板[弹出] */
- (UIView *)paramsMultiplePopType2ViewWithData:(RBSecondKillDetailSepcModel *)data {
    UIView *view = UIView.new;
    view.tag = 2002;
    view.rbExData = data;
    [view rbAddTapGesWithTarget:self action:@selector(paramsType2ViewTapped:)];
    [view view_addView:({
        UIView *view = UIView.new;
        view.backgroundColor = UIColor.whiteColor;
        [view rbSetCornerRadius:Zoom(8)];
        
        [view h_view_addView:({
            UILabel *view = [RanTool labelWithFontSize:Zoom(13) weight:0 color:[RBThemeConfig textBlackColor] align:0 text:data.name];
            [view addPriority:1];
            view;
        }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(21) bottom:Zoom(21) left:Zoom(16) right:0 centerY:0];
        
        [view h_view_addView:({
            UILabel *view = [RanTool labelWithFontSize:Zoom(13) weight:0 color:[RBThemeConfig textLightBlackColor] align:2 text:@""];
            view.tag = 333;
            view;
        }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:Zoom(12) right:0 centerY:0];
        
        [view h_view_addView:[RanTool imgViewWithMode:1 radius:0 imgName:@"mine_arrow_right"] withHeight:Zoom(13) width:Zoom(8) top:CGFLOAT_MIN bottom:CGFLOAT_MIN left:Zoom(12) right:Zoom(11) centerY:YES];

        view;
    }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerX:0];
    
    [self reloadParamsType2:view];
    return view;
}
/** 3选择器模板[弹出] */
- (UIView *)paramsSelectorPopType3ViewWithData:(RBSecondKillDetailSepcModel *)data {
    UIView *view = UIView.new;
    view.tag = 2003;
    view.rbExData = data;
    [view rbAddTapGesWithTarget:self action:@selector(paramsType3ViewTapped:)];
    [view view_addView:({
        UIView *view = UIView.new;
        view.backgroundColor = UIColor.whiteColor;
        [view rbSetCornerRadius:Zoom(8)];
        
        [view h_view_addView:({
            UILabel *view = [RanTool labelWithFontSize:Zoom(13) weight:0 color:[RBThemeConfig textBlackColor] align:0 text:data.name];
            [view addPriority:1];
            view;
        }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(21) bottom:Zoom(21) left:Zoom(16) right:0 centerY:0];
        
        [view h_view_addView:({
            UILabel *view = [RanTool labelWithFontSize:Zoom(13) weight:0 color:[RBThemeConfig textLightBlackColor] align:2 text:@""];
            view.tag = 333;
            view.tag = 333;
            view;
        }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:Zoom(12) right:0 centerY:0];
        
        [view h_view_addView:[RanTool imgViewWithMode:1 radius:0 imgName:@"mine_arrow_right"] withHeight:Zoom(13) width:Zoom(8) top:CGFLOAT_MIN bottom:CGFLOAT_MIN left:Zoom(12) right:Zoom(11) centerY:YES];

        view;
    }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerX:0];
    
    return view;
}
/** 4单选模板[弹出][多项] */
- (UIView *)paramsSinglePopType4ViewWithData:(RBSecondKillDetailSepcModel *)data {
    UIView *view = UIView.new;
    view.tag = 2004;
    view.rbExData = data;
    [view rbAddTapGesWithTarget:self action:@selector(paramsType4ViewTapped:)];
    [view view_addView:({
        UIView *view = UIView.new;
        view.backgroundColor = UIColor.whiteColor;
        [view rbSetCornerRadius:Zoom(8)];
        
        [view h_view_addView:({
            UILabel *view = [RanTool labelWithFontSize:Zoom(13) weight:0 color:[RBThemeConfig textBlackColor] align:0 text:data.name];
            [view addPriority:1];
            view;
        }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(21) bottom:Zoom(21) left:Zoom(16) right:0 centerY:0];
        
        [view h_view_addView:({
            UILabel *view = [RanTool labelWithFontSize:Zoom(13) weight:0 color:[RBThemeConfig textLightBlackColor] align:2 text:@""];
            view.tag = 333;
            view;
        }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:Zoom(12) right:0 centerY:0];
        
        [view h_view_addView:[RanTool imgViewWithMode:1 radius:0 imgName:@"mine_arrow_right"] withHeight:Zoom(13) width:Zoom(8) top:CGFLOAT_MIN bottom:CGFLOAT_MIN left:Zoom(12) right:Zoom(11) centerY:YES];

        view;
    }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerX:0];
    
    return view;
}
/** 5牙位模板[显示]; */
- (UIView *)paramsChooseToothDisplayType5ViewWithData:(RBSecondKillDetailSepcModel *)data {
    UIView *view = UIView.new;
    view.rbExData = data;
    [view view_addView:({
        UIView *view = UIView.new;
        view.backgroundColor = UIColor.whiteColor;
        [view rbSetCornerRadius:Zoom(8)];
        
        //牙齿选择
        [view view_addView:({
            UIView *view = UIView.new;
            [view h_view_addView:({
                UILabel *view = [RanTool labelWithFontSize:Zoom(15) weight:2 color:[RBThemeConfig textBlackColor] align:0 text:@"牙齿选择"];
                [view addPriority:1];
                view;
            }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerY:0];
            [view h_view_addView:[RanTool labelWithFontSize:Zoom(13) weight:0 color:[RBThemeConfig textBlackColor] align:0 text:data.is_add_type == 0? @"(固定价格)": @"(商品价格)"] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerY:0];
            view;
        }) withHeight:Zoom(44) width:CGFLOAT_MIN top:0 bottom:Zoom(10) left:Zoom(16) right:Zoom(16) centerX:0];
        //牙齿
        NSArray *toothArray = [self toothArrayWithModel:data];
        for (NSDictionary *dic in toothArray) {
            [view view_addView:[self toothViewWithData:dic] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(16) bottom:Zoom(26) left:0 right:0 centerX:0];
        }
        view;
    }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerX:NO];
    return view;
}
- (NSArray *)toothArrayWithModel: (RBSecondKillDetailSepcModel *)model {
    NSMutableArray *arrayM = NSMutableArray.array;
    for (NSInteger i = 0; i < 4; i++) {
        NSMutableDictionary *dic = NSMutableDictionary.dictionary;
        dic[@"title"] = ({
            NSMutableArray *arrayM = NSMutableArray.array;
            for (RBGoodsDetailSpecItemModel *item in model.spec) {
                [arrayM addObject:item.spec_name];
            }
            arrayM;
        })[i];
        dic[@"img"] = @[@"tup",@"tup",@"tdown",@"tdown"][i];
        dic[@"imgSel"] = @[@"tupSel",@"tupSel",@"tdownSel",@"tdownSel"][i];
        dic[@"count"] = @"8";
        dic[@"data"] = model.spec[i];
        [arrayM addObject:dic];
    }
    return arrayM;
}
- (NSMutableArray *)toothBtnsArrayM {
    if (!_toothBtnsArrayM) {
        self.toothBtnsArrayM = NSMutableArray.array;
    }
    return _toothBtnsArrayM;
}
- (UIView *)toothViewWithData: (NSDictionary *)dic {
    UIView *view = UIView.new;
    [view view_addView:[RanTool labelWithFontSize:Zoom(13) weight:0 color:[RBThemeConfig textGrayColor] align:0 text:dic[@"title"]] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:Zoom(13) right:0 centerX:0];
    RBGoodsDetailSpecItemModel *model = dic[@"data"];
    [view view_addView:({
        UIView *view = UIView.new;
        NSInteger count = [dic[@"count"] integerValue];
        for (NSInteger i = 1; i <= count; i++) {
            UIButton *btn = UIButton.new;
            btn.rbExData = model.spec_son[i-1];
            if ([dic[@"img"] containsString:@"tup"]) {
                btn.titleEdgeInsets = UIEdgeInsetsMake(Zoom(10), 0, 0, 0);
            } else {
                btn.titleEdgeInsets = UIEdgeInsetsMake(0, 0, Zoom(5), 0);
            }
            [btn setBackgroundImage:[UIImage imageNamed:dic[@"img"]] forState:UIControlStateNormal];
            [btn setBackgroundImage:[UIImage imageNamed:dic[@"imgSel"]] forState:UIControlStateSelected];
            [btn rbSetTitleColor:UIColor.whiteColor];
            [btn rbSetFontSize:Zoom(13)];
            [btn rbSetTitle:[NSString stringWithFormat:@"%zd", i]];
            [btn rbAddTarget:self action:@selector(toothBtnTapped:)];
            [self.toothBtnsArrayM addObject:btn];
            [view h_view_addView:btn withHeight:CGFLOAT_MIN width:Zoom(24) top:0 bottom:0 left:i == 1? 0: Zoom(18) right:CGFLOAT_MIN centerY:0];
        }
        view;
    }) withHeight:Zoom(27) width:CGFLOAT_MIN top:Zoom(13) bottom:0 left:Zoom(13) right:0 centerX:0];
    return view;
}
/** 6牙排模板[弹出] */
- (UIView *)paramsAddToothPopType6ViewWithData:(RBSecondKillDetailSepcModel *)data {
    UIView *view = UIView.new;
    view.tag = 2006;
    view.rbExData = data;
    [view rbAddTapGesWithTarget:self action:@selector(paramsType6ViewTapped:)];
    [view view_addView:({
        UIView *view = UIView.new;
        view.backgroundColor = UIColor.whiteColor;
        [view rbSetCornerRadius:Zoom(8)];
        
        [view h_view_addView:({
            UILabel *view = [RanTool labelWithFontSize:Zoom(13) weight:0 color:[RBThemeConfig textBlackColor] align:0 text:data.name];
            [view addPriority:1];
            view;
        }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(21) bottom:Zoom(21) left:Zoom(16) right:0 centerY:0];
        
        [view h_view_addView:({
            UILabel *view = [RanTool labelWithFontSize:Zoom(11) weight:0 color:[RBThemeConfig textLightBlackColor] align:2 text:@""];
            view.tag = 333;
            view;
        }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:Zoom(12) right:0 centerY:0];
        
        [view h_view_addView:[RanTool imgViewWithMode:1 radius:0 imgName:@"mine_arrow_right"] withHeight:Zoom(13) width:Zoom(8) top:CGFLOAT_MIN bottom:CGFLOAT_MIN left:Zoom(12) right:Zoom(11) centerY:YES];

        view;
    }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerX:0];
    
    return view;
}
//评价
- (UIView *)evaluateViewWith:(RBSecondKillDetailModel *)data {
    UIView *view = UIView.new;
    view.backgroundColor = UIColor.whiteColor;
    [view rbSetCornerRadius:Zoom(8)];
    //评价总数
    [view view_addView:({
        UIView *view = UIView.new;
        [view h_view_addView:({
            UILabel *view = [RanTool labelWithFontSize:Zoom(18) weight:2 color:[RBThemeConfig textBlackColor] align:0 text:@"评价"];
            [view addPriority:1];
            view;
        }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerY:0];
        
        [view h_view_addView:[RanTool labelWithFontSize:Zoom(15) weight:0 color:[RBThemeConfig textBlackColor] align:0 text:[NSString stringWithFormat:@"(%@)", data.evaluate_count]] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerY:0];
        
        [view h_view_addView:[RanTool imgViewWithMode:1 radius:0 imgName:@"mine_arrow_right"] withHeight:Zoom(13) width:Zoom(8) top:CGFLOAT_MIN bottom:CGFLOAT_MIN left:Zoom(12) right:0 centerY:YES];
        
        
        view;
    }) withHeight:Zoom(50) width:CGFLOAT_MIN top:0 bottom:0 left:Zoom(16) right:Zoom(11) centerX:0];
    //列表
    for (RBSecondKillDetailEvaluateModel *model in data.evaluate) {
        NSInteger index = [data.evaluate indexOfObject:model];
        CGFloat top = Zoom(20);
        if (index == 0) {
            top = 0;
        }
        [view view_addView:[self evaluateItemViewWith:model] withHeight:CGFLOAT_MIN width:Zoom(350) top:top bottom:0 left:CGFLOAT_MIN right:CGFLOAT_MIN centerX:0];
    }
    //底部
    [view view_addView:({
        UIView *view = UIView.new;
        [view view_addView:({
            UILabel *view = [RanTool labelWithFontSize:Zoom(12) weight:0 color:[RBThemeConfig textBlackColor] align:1 text:@"查看全部" bgColor:UIColor.whiteColor radius:Zoom(15)];
            [view rbSetBorderWitdh:1 borderColor:[UIColor colorWithHexString:@"#BFBFBF"]];
            [view rbAddTapGesWithTarget:self action:@selector(checkTotalEvaluateAction)];
            view;
        }) withHeight:Zoom(30) width:Zoom(100) top:Zoom(14) bottom:CGFLOAT_MIN left:CGFLOAT_MIN right:CGFLOAT_MIN centerX:YES];
        view;
    }) withHeight:Zoom(59) width:CGFLOAT_MIN top:Zoom(10) bottom:0 left:0 right:0 centerX:0];
    
    return view;
}
//评价内容
- (UIView *)evaluateItemViewWith:(RBSecondKillDetailEvaluateModel *)model {
    UIView *itemV = UIView.new;
    
    [itemV view_addView:({
        UIView *view = UIView.new;
        //是否匿名
        NSString *nameString = model.nickname;
        NSString *avatar = model.avatar;
        if ([model.is_anonymous isEqualToString:@"1"]) {
            nameString = @"匿名";
            avatar = @"iconDefault";
        }
        //头像
        [view h_view_addView:[RanTool imgViewWithMode:2 radius:Zoom(19) imgName:avatar] withHeight:Zoom(38) width:Zoom(38) top:0 bottom:0 left:Zoom(15) right:0 centerY:0];
        //
        [view h_view_addView:({
            UIView *view = UIView.new;
            [view view_addView:[RanTool labelWithFontSize:Zoom(12) weight:0 color:[RBThemeConfig textGrayColor] align:0 text:nameString] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerX:0];
            //
            [view view_addView:({
                UIView *view = UIView.new;
                //星级
                NSString *star_num = model.star_num;
                [view h_view_addView:({
                    UIView *view = UIView.new;
                    [view addPriority:1];
                    view.backgroundColor = [RBThemeConfig bgGrayColor];
                    [view rbSetCornerRadius:Zoom(7)];
                    
                    CGFloat point = [star_num floatValue];;
                    for (NSInteger i = 1; i <= 5; i++) {
                        NSString *imgName = @"";
                        if (point >= i) {
                            imgName = @"shopStartSel";
                        } else if(point > i - 1) {
                            imgName = @"shopStartHalf";
                        } else {
                            imgName = @"shopStart";
                        }
                        [view h_view_addView:[RanTool imgViewWithMode:0 radius:0 imgName:imgName] withHeight:Zoom(9) width:Zoom(8) top:CGFLOAT_MIN bottom:CGFLOAT_MIN left:i == 1? Zoom(5): Zoom(1) right:i == 5? Zoom(5): 0 centerY:YES];
                    }
                    
                    view;
                }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerY:0];
                //
                [view h_view_addView:[RanTool labelWithFontSize:Zoom(12) weight:0 color:[RBThemeConfig textGrayColor] align:0 text:star_num] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:Zoom(8) right:0 centerY:0];
                //时间
                [view h_view_addView:({
                    UILabel *view = [RanTool labelWithFontSize:Zoom(12) weight:0 color:[RBThemeConfig textGrayColor] align:0 text:model.create_time];
                    [view addPriority:2];
                    view;
                }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerY:0];
                
                view;
            }) withHeight:Zoom(14) width:CGFLOAT_MIN top:Zoom(7) bottom:0 left:0 right:0 centerX:0];
            
            
            view;
        }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:CGFLOAT_MIN bottom:CGFLOAT_MIN left:Zoom(7) right:Zoom(15) centerY:YES];
        
        view;
    }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerX:0];
    
    [itemV view_addView:({
        UILabel *contentL = UILabel.new;
        contentL.numberOfLines = 2;
        contentL.attributedText = [RanTool attributeStringMaker:^(NSMutableArray *maker) {
            [maker addAttributeStringWithFont:[UIFont systemFontOfSize:Zoom(13)] color:[RBThemeConfig textBlackColor] string:model.content lineSpacing:Zoom(7)];
        }];
        contentL;
    }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(13) bottom:0 left:Zoom(18) right:Zoom(18) centerX:0];
    
    return itemV;
}
//店铺信息
- (UIView *)shopViewWith:(RBSecondKillDetailShopInfoModel *)data {
    UIView *view = UIView.new;
    view.backgroundColor = UIColor.whiteColor;
    [view rbSetCornerRadius:Zoom(8)];
    
    [view view_addView:({
        UIView *view = UIView.new;
        [view h_view_addView:[RanTool imgViewWithMode:2 radius:Zoom(22) imgName:data.logo] withHeight:Zoom(44) width:Zoom(44) top:0 bottom:0 left:0 right:0 centerY:0];
        [view h_view_addView:({
            UIView *view = UIView.new;
            [view view_addView:[RanTool labelWithFontSize:Zoom(15) weight:2 color:[RBThemeConfig textBlackColor] align:0 text:data.store_name] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerX:0];
            [view view_addView:[RanTool labelWithFontSize:Zoom(12) weight:1 color:[RBThemeConfig textGrayColor] align:0 text:data.content] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(7) bottom:0 left:0 right:0 centerX:0];
            view;
        }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:CGFLOAT_MIN bottom:CGFLOAT_MIN left:Zoom(11) right:0 centerY:YES];
        [view h_view_addView:[RanTool imgViewWithMode:1 radius:0 imgName:@"mine_arrow_right"] withHeight:Zoom(13) width:Zoom(8) top:CGFLOAT_MIN bottom:CGFLOAT_MIN left:Zoom(12) right:0 centerY:YES];
       
        [view rbAddTapGesWithTarget:self action:@selector(tapShopInfo:)];
        view;
    }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(17) bottom:Zoom(17) left:Zoom(10) right:Zoom(10) centerX:NO];
    /*
    [view view_addView:({
        UIScrollView *view = UIScrollView.new;
        view.showsVerticalScrollIndicator = NO;
        view.showsHorizontalScrollIndicator = NO;
        [view h_rbSetContentHeight:Zoom(100)];
        for (RBGoodsDetailShopGoodsModel *model in data.shop_goods) {
            [view h_addView:({
                UIView *view = UIView.new;
                [view view_addView:[RanTool imgViewWithMode:2 radius:Zoom(8) imgName:model.picurl] withHeight:Zoom(78) width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerX:0];
                [view view_addView:UILabel.new withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerX:0];
                [view view_addView:({
                    UILabel *view = [RanTool labelWithFontSize:Zoom(12) weight:0 color:[RBThemeConfig textBlackColor] align:1 text:model.good_name];
                    [view addVPriority:1];
                    view;
                }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerX:0];
                view.rbExData = model;
                [view rbAddTapGesWithTarget:self action:@selector(tapShopGood:)];
                view;
            }) withHeight:CGFLOAT_MIN width:Zoom(78) top:0 bottom:0 left:Zoom(8) right:Zoom(8) centerY:0];
        }
        view;
    }) withHeight:Zoom(100) width:CGFLOAT_MIN top:Zoom(15) bottom:0 left:0 right:0 centerX:0];
    
    [view view_addView:({
        UIView *view = UIView.new;
        [view h_view_addView:({
            UIView *view = [RanTool labelWithFontSize:Zoom(12) weight:0 color:[RBThemeConfig textBlackColor] align:1 text:@"联系客服" bgColor:nil radius:Zoom(15) borderWidth:1 borderColor:@"#BFBFBF" lines:1 linePadding:0 hPriority:0];
            [view rbAddTapGesWithTarget:self action:@selector(clickContactService)];
            view;
        }) withHeight:CGFLOAT_MIN width:Zoom(100) top:0 bottom:0 left:Zoom(66) right:0 centerY:0];
        [view h_view_addView:({
            UIView *view = [RanTool labelWithFontSize:Zoom(12) weight:0 color:[RBThemeConfig textBlackColor] align:1 text:@"进店逛逛" bgColor:nil radius:Zoom(15) borderWidth:1 borderColor:@"#BFBFBF" lines:1 linePadding:0 hPriority:0];
            [view rbAddTapGesWithTarget:self action:@selector(tapShop:)];
            view;
        }) withHeight:CGFLOAT_MIN width:Zoom(100) top:0 bottom:0 left:Zoom(14) right:CGFLOAT_MIN centerY:0];
        view;
    }) withHeight:Zoom(30) width:CGFLOAT_MIN top:Zoom(29) bottom:Zoom(20) left:0 right:0 centerX:0];
    */
    return view;
}
//web页面
- (UIView *)detailView {
    UIView *view = UIView.new;
    view.backgroundColor = UIColor.whiteColor;
    [view rbSetCornerRadius:Zoom(8)];
    
    [view view_addView:({
        UIView *view = UIView.new;
        [view h_view_addView:[RanTool labelWithFontSize:Zoom(15) weight:2 color:[RBThemeConfig textBlackColor] align:0 text:@"详情"] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:Zoom(12) right:0 centerY:0];
        [view h_view_addView:[RanTool imgViewWithMode:1 radius:0 imgName:@"mine_arrow_right"] withHeight:Zoom(13) width:Zoom(8) top:CGFLOAT_MIN bottom:CGFLOAT_MIN left:Zoom(12) right:0 centerY:YES];
        view;
    }) withHeight:Zoom(50) width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerX:0];
    
    [view view_addView:({
        UIView *view = UIView.new;
        [view addSubview:self.detailWebView];
        [self.detailWebView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.top.bottom.mas_equalTo(0);
        }];
        view;
    }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(10) bottom:Zoom(10) left:Zoom(10) right:Zoom(10) centerX:0];
    
    return view;
}



//webView
- (RBGoodsDetailWebView *)detailWebView {
    if (!_detailWebView) {
        self.detailWebView = ({
            RBGoodsDetailWebView *view = [RBGoodsDetailWebView.alloc initWithFrame:CGRectMake(0, 0, kRBMainScreenWidth - Zoom(12)*2 - Zoom(10)*2, 10)];
            view;
        });
    }
    return _detailWebView;
}
//底部view
- (UIView *)bottomView {
    if (!_bottomView) {
        self.bottomView = ({
            UIView *view = UIView.new;
            view.backgroundColor = UIColor.whiteColor;
            view.layer.shadowColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.1].CGColor;
            view.layer.shadowOffset = CGSizeMake(0,0);
            view.layer.shadowOpacity = 1;
            view.layer.shadowRadius = 5;
            [self.view addSubview:view];
            [view mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.right.mas_equalTo(0);
                make.height.mas_equalTo(Zoom(59));
                make.bottom.mas_equalTo(-kRBSafeBottomHeight);
            }];
            
            CGFloat itemW = Zoom(42);
            
            [view h_view_addView:({
                UIView *view = UIView.new;
                [view view_addView:[RanTool imgViewWithMode:1 radius:0 imgName:@"orderDetailShop"] withHeight:Zoom(17) width:Zoom(17) top:Zoom(15) bottom:0 left:CGFLOAT_MIN right:CGFLOAT_MIN centerX:YES];
                [view view_addView:[RanTool labelWithFontSize:Zoom(10) weight:0 color:@"#454545" align:1 text:@"店铺"] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(5) bottom:CGFLOAT_MIN left:0 right:0 centerX:0];
                [view rbAddTapGesWithTarget:self action:@selector(tapShop:)];
                view;
            }) withHeight:CGFLOAT_MIN width:itemW top:0 bottom:0 left:Zoom(8) right:0 centerY:0];
            
            [view h_view_addView:({
                UIView *view = UIView.new;
                [view view_addView:[RanTool imgViewWithMode:1 radius:0 imgName:@"orderDetailService"] withHeight:Zoom(17) width:Zoom(17) top:Zoom(15) bottom:0 left:CGFLOAT_MIN right:CGFLOAT_MIN centerX:YES];
                [view view_addView:[RanTool labelWithFontSize:Zoom(10) weight:0 color:@"#454545" align:1 text:@"客服"] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(5) bottom:CGFLOAT_MIN left:0 right:0 centerX:0];
                [view rbAddTapGesWithTarget:self action:@selector(clickContactService)];
                view;
            }) withHeight:CGFLOAT_MIN width:itemW top:0 bottom:0 left:0 right:0 centerY:0];
            
            [view h_view_addView:UILabel.new withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerY:0];
           
            CGFloat btnW = Zoom(106);
            CGFloat btnH = Zoom(40);
            
            [view h_view_addView:({
                RBGradientView *view = [RBGradientView gradientViewWithColors:@[[UIColor colorWithHexString:@"#518CFF"], [UIColor colorWithHexString:@"#2A6DF0"]] locations:nil vertical:NO];
                [view rbAddTapGesWithTarget:self action:@selector(buyBtnTapped)];
                [view rbSetCornerRadius:btnH/2];
                [view view_addView:[RanTool labelWithFontSize:Zoom(14) weight:0 color:UIColor.whiteColor align:1 text:@"立即购买"] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerX:0];
                view;
            }) withHeight:btnH width:btnW top:CGFLOAT_MIN bottom:CGFLOAT_MIN left:CGFLOAT_MIN right:Zoom(15) centerY:YES];
            
            view;
        });
    }
    return _bottomView;
}
//定时器
- (RBTimer *)timer {
    if (!_timer) {
        self.timer = RBTimer.new;
    }
    return _timer;
}


@end
